package com.huabo.contract.oracle.mapper;

import com.hbfk.util.PageInfo;
import com.huabo.contract.oracle.entity.TblLegalCloseinformation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huabo
 * @since 2022-03-22
 */
public interface TblLegalCloseinformationMapper extends BaseMapper<TblLegalCloseinformation> {

    @SelectProvider(type=TblLegalCloseinformationMapperSqlConfig.class,method="findListByPageInfo")
    List<TblLegalCloseinformation> findListByPageInfo(PageInfo<TblLegalCloseinformation> pageInfo, TblLegalCloseinformation closeInfo,Integer disputeid);

    @SelectProvider(type=TblLegalCloseinformationMapperSqlConfig.class,method="findListByPageInfoCount")
    Integer findListByPageInfoCount(TblLegalCloseinformation closeInfo,Integer disputeid);

    @Select("SELECT * FROM TBL_LEGAL_CLOSEINFORMATION tlc\n" +
            "LEFT JOIN TBL_STAFF ts on tlc.CREATESTAFF = ts.STAFFID\n" +
            "LEFT JOIN TBL_LEGAL_DISPUTREGISTRATION tld on tlc.DISPUTINFO = tld.DISPUTEID " +
            "WHERE tlc.CLOSEID = #{closeId}")
    TblLegalCloseinformation findByCloseId(Integer closeId);

    @InsertProvider(type=TblLegalCloseinformationMapperSqlConfig.class,method="addDisputeSettlement")
    @Options(useGeneratedKeys=true, keyProperty="closeid", keyColumn="CLOSEID")
    void addDisputeSettlement(TblLegalCloseinformation closeInfo);

    @UpdateProvider(type=TblLegalCloseinformationMapperSqlConfig.class,method="updateModifyDisputeSettlementModify")
    void updateModifyDisputeSettlementModify(TblLegalCloseinformation oldCloseInfo);

    @Delete("DELETE FROM TBL_LEGAL_CLOSEINFORMATION WHERE CLOSEID = #{closeid}")
    void removeDisputeSettlementRemove(Integer closeid);
}
